<template>
	<view class="main">
		<u-navbar :is-back="false" :title="i18n.navbar.mine" :background="background" :border-bottom="false" title-color="#fff"
			back-icon-color="#fff">
	<!-- 		<view class="slot-wrap">
				{{i18n.navbar.mine}}
			</view> -->


		</u-navbar>

		<view class="all">
			<view class="head">
				<view class="head_l">
					<image :src="shopinfo.avatar" mode=""></image>
				</view>
				<view class="head_r">
					<text>{{info.name}}</text>
				</view>
			</view>


			<view class="lists">
				<view class="noice_of" @click="router('../business_info/business_info')">
					<view class="noice_l">
						<image src="../../../static/images/info.png" mode=""></image>
						<text>{{i18n.user.shopinfo}}</text>
					</view>
					<u-icon name="arrow-right" size="18"></u-icon>
				</view>
				<view class="noice_of" @click="router('../manage_accounts/manage_accounts')">
					<view class="noice_l">
						<image src="../../../static/images/guanli.png" mode=""></image>
						<text>{{i18n.user.manage}}</text>
					</view>
					<u-icon name="arrow-right" size="18"></u-icon>
				</view>
				<view class="noice_of" @click="router('../cash_flow/cash_flow')">
					<view class="noice_l">
						<image src="../../../static/images/zj.png" mode=""></image>
						<text>{{i18n.user.funds}}</text>
					</view>
					<u-icon name="arrow-right" size="18"></u-icon>
				</view>
				<view class="noice_of" @click="router('../transfer_record/transfer_record')">
					<view class="noice_l">
						<image src="../../../static/images/zz.png" mode=""></image>
						<text>{{i18n.user.record}}</text>
					</view>
					<u-icon name="arrow-right" size="18"></u-icon>
				</view>
				<view class="noice_of" @click="router('../chargeback_manage/chargeback_manage')">
					<view class="noice_l">
						<image src="../../../static/images/td.png" mode=""></image>
						<text>{{i18n.user.chargeback}}</text>
					</view>
					<u-icon name="arrow-right" size="18"></u-icon>
				</view>
				<view class="noice_of" @click="router('../commission_details/commission_details')">
					<view class="noice_l">
						<image src="../../../static/images/yj.png" mode=""></image>
						<text>{{i18n.user.commission}}</text>
					</view>
					<u-icon name="arrow-right" size="18"></u-icon>
				</view>
				<view class="noice_of" @click="router('../bill_manage/bill_manage')">
					<view class="noice_l">
						<image src="../../../static/images/zdgl.png" mode=""></image>
						<text>{{i18n.user.bill}}</text>
					</view>
					<u-icon name="arrow-right" size="18"></u-icon>
				</view>
				<view class="noice_of" @click="router('../share/share')">
					<view class="noice_l">
						<image src="../../../static/images/yq.png" mode=""></image>
						<text>{{i18n.user.invite}}</text>
					</view>
					<u-icon name="arrow-right" size="18"></u-icon>
				</view>



				<view class="noice_of" @click="router('../connect_service/connect_service')">
					<view class="noice_l">
						<image src="../../../static/images/kf.png" mode=""></image>
						<text>{{i18n.user.service}}</text>
					</view>
					<u-icon name="arrow-right" size="18"></u-icon>
				</view>
				<view class="noice_of" @click="changelang">
					<view class="noice_l">
						<image src="../../../static/images/lang.png" mode=""></image>
						<text>{{i18n.user.language}}</text>
					</view>
					<view class="noice_r">
						<text class="lang">{{txt}}</text>
						<u-icon name="arrow-right" size="18"></u-icon>
					</view>
				</view>
			</view>
		</view>
		<u-select v-model="show" :list="dataList" @confirm="confirm"></u-select>
	</view>

	</view>
</template>
<script>
	export default {
		data() {
			return {
				background: {
					backgroundColor: '#304156',
				},
				show: false,
				txt: '',
				shopinfo:'',
				info:''
			}
		},
		computed: {
			i18n() {
				return this.$t('message')
			},
		},
		onLoad() {
			this.getinfo()
			this.getconfiginfo()
			if(uni.getStorageSync('index')==''){
				this.txt='中文简体'
			}else{
				this.txt = this.dataList[uni.getStorageSync('index')].label
			}
		},
		onShow() {
			this.lang()
			let items = this.dataList;
			let ind = uni.getStorageSync('index'),
				lang = uni.getStorageSync('select');
			// 判断选择的语言
			if (lang) {
				this.$i18n.locale = lang;
			} else {
				this.$i18n.locale = 'zh-CN';
			}

		},
		methods: {
			getinfo(){
				global.$http.request({
					url:'/api/admin/merchant/base/info',
					header: {
						'Authori-zation': uni.getStorageSync('token') //自定义请求头信息
					},
					method: 'GET',
				}).then(res=>{
					if(res.data.code==200){
						console.log(res.data.data);
						this.info=res.data.data
					}
				})
			},
		
			getconfiginfo(){
				global.$http.request({
					url:'/api/admin/merchant/config/info',
					header: {
						'Authori-zation': uni.getStorageSync('token') //自定义请求头信息
					},
					method: 'GET',
				}).then(res=>{
					if(res.data.code==200){
						console.log(res.data.data);
						this.shopinfo=res.data.data
					}
				})
			},
			
			
			
			
			
			changelang() {
				this.show = true
			},
			lang() {
				this._i18n.locale = uni.getStorageSync('select')
			},
			router(path) {
				uni.navigateTo({
					url: path
				})

			},
			confirm(e) {
				console.log(e);
				this.txt = e[0].label
				let _this = this;
				let items = _this.dataList;
				for (let i = 0; i < items.length; i++) {
					if (items[i].label == e[0].label) {

						// console.log(e.target.value);
						// console.log(items[i].value);

						// 存储选择的下标
						uni.setStorageSync('index', i);
						// 存储选择的语言
						uni.setStorageSync('select', items[i].language);
						_this.$i18n.locale = items[i].language;
						// tabbar多语言
						break;
					}
				}
			}
		}
	}
</script>

<style lang="scss">
	page {
		font-family: PingFang SC;
		background-color: #f7f7f7;

		.main {
			width: 750rpx;

			.slot-wrap {
				width: 750rpx;
				text-align: center;
				/* 如果您想让slot内容占满整个导航栏的宽度 */
				/* flex: 1; */
				/* 如果您想让slot内容与导航栏左右有空隙 */
				/* padding: 0 30rpx; */
				font-size: 32rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #FFFFFF;
			}

			.all {
				.head {
					width: 750rpx;
					height: 180rpx;
					background: #304156;
					display: flex;
					align-items: center;
					padding-bottom: 40rpx;

					.head_l {
						width: 128rpx;
						height: 128rpx;
						border-radius: 100%;
						overflow: hidden;
						margin-left: 30rpx;

						image {
							width: 128rpx;
							height: 128rpx;
						}
					}

					.head_r {
						padding-left: 31rpx;
						font-size: 34rpx;
						font-family: PingFang SC;
						font-weight: bold;
						color: #FFFFFF;
					}
				}

				.lists {
					.noice_of {
						background-color: #fff;
						margin-bottom: 2rpx;
						display: flex;
						justify-content: space-between;
						padding: 12rpx 30rpx 12rpx 9rpx;

						.noice_l {
							display: flex;
							align-items: center;

							text {
								font-size: 28rpx;
								font-family: Source Han Sans CN;
								font-weight: 400;
								color: #4D4D4D;
							}

							image {
								width: 64rpx;
								height: 64rpx;
							}
						}

						.noice_r {
							display: flex;
							align-items: center;

							.lang {
								padding-right: 15rpx;
							}
						}
					}
				}
			}
		}
	}
</style>
